<template>
  <rx-layout>
    <div slot="center" style>
      <rx-fit>
        <div slot="toolheader" foldheader="true" foldbtn="false" border="false">
          <div class="table-operator">
            <rx-button alias="sysErrorLogDelete" :butn-icon="'delete'" :butn-type="'primary'"
                       :show-no-right="true" @click="delByIds(selectedRowKeys)">{{$ti18('rxList.delBtn','删除')}}</rx-button>
          </div>
          <span class="search-btn-box">
                <span class="search-btn" @click="searchshow"><i class="iconfont iconguolv"></i>{{$ti18('rxList.leachBtn','过滤')}}</span>
           </span>
        </div>
        <div slot="searchbar" btnalign="right"  v-if="fitSearch" @search="search" @cancel="cancel" @close="close">
          <a-form layout="vertical">
                <a-form-item label="应用名称">
                    <a-input :placeholder="i18n('query.clientName','请输入应用名称')" v-model="queryParam.Q_CLIENT_NAME__S_LK"/>
                </a-form-item>
                <a-form-item label="访问IP">
                    <a-input :placeholder="i18n('query.ip','请输入访问IP')" v-model="queryParam.Q_IP__S_LK"/>
                </a-form-item>
                <a-form-item label="操作用户">
                    <a-input :placeholder="i18n('query.userName','请输入操作用户')" v-model="queryParam.Q_USER_NAME__S_LK"/>
                </a-form-item>
          </a-form>
        </div>
        <rx-grid
                ref="table"
                :allowRowSelect="true"
                :multiSelect="true"
                :columns="columns"
                :defaultPageSize="10"
                url="/api-user/user/org/applicationAccessLog/query"
                :queryParam="queryParam"
                data-field="result.data"
                :pageSizeOptions="['10','30','40']"
                id-field="id"
                @selectChange="onSelectChange"
        >
          <span slot="action" slot-scope="{ text, record }" class="actionIcons">
            <span  @click="detail(record)">{{$ti18('rxList.detailBtn','明细')}}</span>
          </span>
        </rx-grid>
      </rx-fit>
    </div>
  </rx-layout>
</template>

<script>
  import ApplicationAccessLogApi from '@/api/user/org/applicationAccessLog'
  import ApplicationAccessLogDetail from './ApplicationAccessLogDetail'
  import {BaseList,RxFit,RxGrid } from "@lowcode/jpaas-common-lib";
  export default {
    name: 'ApplicationAccessLogList',
    mixins: [BaseList],
    components: {
      RxFit
    },
    data() {
      return {
        columns: [
          {
            title: this.$ti18('rxList.index','序号'),
            type: 'indexColumn',
            width: 100,
            dataIndex: 'serial',
            scopedSlots: {customRender: 'serial'}
          },
          {title: this.i18n('list.clientName','应用名称'), dataIndex: 'clientName', width: 100},
          {title: this.i18n('list.ip','访问IP'), dataIndex: 'ip', width: 100},
          {title: this.i18n('list.userBrowser','用户使用浏览器'), dataIndex: 'userBrowser', width: 100},
          {title: this.i18n('list.userName','操作用户'), dataIndex: 'userName', width: 100},
          {title: this.$ti18('rxList.action','操作'), width: 100, dataIndex: 'action', scopedSlots: {customRender: 'action'}}
        ],
        detailcomponent:ApplicationAccessLogDetail,
        comment:this.i18n('list.comment',"应用访问日志"),
        widthHeight:['800px','600px'],
        fitSearch:false,
      }
    },
    methods:{
      i18n(name,text,key){
        return this.$ti18(name,text,"ApplicationAccessLog",key);
      },
      delById(ids){
        return ApplicationAccessLogApi.del({ ids: ids.join(',') });
      },
      getListByParams(parameter){
        return ApplicationAccessLogApi.query(parameter)
      }

    }
  }
</script>
<style scoped>
  .table-operator {
    padding:4px;
  }
  .table-operator button {
    margin:2px;
  }
</style>

